#include <QCoreApplication>
#include "server.h"

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    Server* myServer = new Server();

    // 启动服务器
    myServer->startServer();

    // 捕获退出信号
    QObject::connect(&a, &QCoreApplication::aboutToQuit, [myServer]() {
        myServer->stopServer(); // 停止服务器
    });

    return a.exec();
}
